import http from "../utils/http.js";

/**
 * @description: 创建虚拟人视频
 * @param {FormData} formData - 包含virtualmanKey, ssmlText/file, speed的表单数据
 * @return {Promise} 返回任务ID
 */
export async function createVideoApi(formData) {
    return http.post('/api/video/create', formData, {
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    });
}




/**
 * @description: 获取视频URL
 * @param {string} taskId - 任务ID
 * @return {Promise} 返回视频URL或生成状态
 */
export async function getVideoUrlApi(taskId) {
    return http.post('/api/video/result/url', {}, {
        params: {
            taskId: taskId
        }
    });
}

/**
 * @description: 保存媒体到数据库
 * @param {string} taskId - 任务ID
 * @param {string} mediaUrl - 媒体URL
 * @return {Promise} 返回保存结果
 */
export async function saveMediaApi(taskId, mediaUrl) {
    return http.post('/api/media/saveMedia', {}, {
        params: {
            taskId: taskId,
            mediaUrl: mediaUrl
        }
    });
}

